//
//  MSCommentsCell.m
//  MinShengBank
//
//  Created by chen wei on 13-10-14.
//  Copyright (c) 2013年 Hq. All rights reserved.
//

#import "MSCommentsCell.h"

@implementation MSCommentsCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        Titled=[[UILabel alloc]initWithFrame:CGRectMake(10, 5, 170, 18)];
        Titled.font=[UIFont boldSystemFontOfSize:16.0];
        Titled.textColor = [UIColor colorWithHexString:@"5191d2"];
        Titled.backgroundColor = [UIColor clearColor];
        [self addSubview:Titled];
        
//        SubTitle=[[UILabel alloc]initWithFrame:CGRectMake(10, 25, 220, 16)];
//        SubTitle.font=[UIFont systemFontOfSize:13.0];
//        SubTitle.textColor=[UIColor grayColor];
//        SubTitle.numberOfLines=0;
//        SubTitle.lineBreakMode=NSLineBreakByCharWrapping;
//        [self addSubview:SubTitle];
        
        comment=[[UILabel alloc]initWithFrame:CGRectMake(10, 40, 300, 30)];
        comment.font=[UIFont systemFontOfSize:16.0];
        comment.numberOfLines=0;
        comment.backgroundColor = [UIColor clearColor];
        comment.lineBreakMode=NSLineBreakByCharWrapping;
        comment.textColor=[UIColor colorWithHexString:@"121212"];
        [self addSubview:comment];
    }
    return self;
}

-(void)setSubtitle:(NSString *)subtitle {
    SubTitle.text=subtitle;
}

-(void)setCommentText:(NSString *)commentText{
    comment.text=commentText;
    CGSize labelsize = [commentText sizeWithFont:[UIFont systemFontOfSize:16.0] constrainedToSize:CGSizeMake(300,2000) lineBreakMode:NSLineBreakByCharWrapping];
    CGRect rect = CGRectMake(10, 25, 300, labelsize.height);//CGRectInset(cellFrame, 8, 8);
    comment.frame = rect;
    
    CGRect cellFrame = [self frame];
    cellFrame.size.height = comment.frame.size.height+30;
    [self setFrame:cellFrame];
}

-(void)setTitled:(NSString *)titled {
    if ((NSNull*)titled == [NSNull null]) {
        Titled.text = @"";
    }else{
        Titled.text=titled;
    }
    
    
}

-(void)setBackimage:(NSString *)Backimage{
    ImageView=[[UIImageView alloc]initWithImage:[UIImage imageNamed:Backimage]];
    ImageView.frame=CGRectMake(10, 5, 32, 32);
    [self addSubview:ImageView];
}

- (void)setTouiamge:(NSString *)touiamge
{
    Touiamge = [[UrlImageView alloc]initWithFrame:CGRectMake(10, 5, 32, 32)];
    [Touiamge setImageWithURL:[NSURL URLWithString:touiamge]];
    [self addSubview:Touiamge];
}





- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
